package com.suhuamo.thread;

import com.suhuamo.thread.pool.ThreadPool;

/**
 * @author yuanchuncheng
 * @slogan yscz
 * @date 2024-07-19
 * @description
 */
public class Main {
    public static void main(String[] args) {
        ThreadPool threadPool = new ThreadPool();
        threadPool.addTask(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程1+" + i);
            }
        });
        threadPool.addTask(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程2+" + i);
            }
        });
        threadPool.addTask(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程3+" + i);
            }
        });
        threadPool.addTask(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程4+" + i);
            }
        });
        threadPool.addTask(() -> {
            for (int i = 0; i < 100; i++) {
                System.out.println("线程5+" + i);
            }
        });
        System.out.println("主线程启动");
        for (int i = 0; i < 300; i++) {
            System.out.println("主线程+" + i);
        }
        System.out.println("主线程结束，不会再执行下一个任务了");
        threadPool.terminal();
    }
}
